﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once


namespace gdmp {
    namespace api {
        class Base
        {
        public:
            virtual ~Base() = default;

        protected:
            friend class IncompleteType;
            friend class CompleteType;

            virtual void addRef() { m_refCount++; }
            virtual void unRef() {
                m_refCount--;

                if (m_refCount == 0)
                    delete this;
            }

        private:
            int m_refCount{ 0 };
        };
    }
}
